import request from '@/utils/request'
export function commonShowBtn(btnCode,menuId){
    let result = false
    const pageElementListStr = sessionStorage.getItem('pageElementList')
    if(pageElementListStr !=null){
        const pageElementList = JSON.parse(pageElementListStr)
        pageElementList.some(element => {
            if(element.menuId == menuId && element.elementCode==btnCode){
                result = true
                return true
            }
        });
    }
    return result
}

export function initPageElement(){
    userElement().then(response =>{
        sessionStorage.setItem('pageElementList',JSON.stringify(response.data))
    })
}
// 根据id或者对象
function userElement(){
    return request({
        url: '/pageElement/userElement',
        method: 'get'
    })

}